package ontology;

import java.util.Set;
import java.util.TreeSet;

/**
 * This class represents a FrameNet coreness set, abstracted out of the 
 * FrameNet ontology relations file (frXML/frRelation.xml).
 * 
 * A coreness set consists of: (a) a frame name; (b) a set of frame elements 
 * which constitute a coreness set in the frame; and (c) a manufactured name 
 * for the coreness set. 
 */

public class CoreSet {

	public String frame;
	public Set<String> frameElements = new TreeSet<String>(); 
	public String name;
	
	public CoreSet(FrameRelation l,FERelation a) {
		frame = l.superFrameName;
		frameElements.add(a.subFEName);
		frameElements.add(a.superFEName);		
		for (FERelation b: l.feLinks) {
			if (frameElements.contains(b.subFEName)) {
				frameElements.add(b.superFEName);
			}
			else if (frameElements.contains(b.superFEName)) {
				frameElements.add(b.subFEName);
			}
		}		
		name = "";
		// the name is the concatenation of the individual role names
		for (String s: frameElements) {
			name = name + s + ":";
		}
		name = name.substring(0,name.length()-1);
	}
	
	public String toString() {
		String s = frame;
		s = s + "  " + name;
		return s;
	}
	
}
